from sqlalchemy import Column, Integer, String, SmallInteger
from mooc.db.database import Base

class AccountWechats(Base):
    __tablename__ = "ims_account_wechats"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, nullable=False)
    token = Column(String(32), nullable=False)
    encodingaeskey = Column(String(255), nullable=False)
    level = Column(SmallInteger, nullable=False)
    name = Column(String(30), nullable=False)
    account = Column(String(30), nullable=False)
    original = Column(String(50), nullable=False)
    signature = Column(String(100), nullable=False)
    country = Column(String(10), nullable=False)
    province = Column(String(3), nullable=False)
    city = Column(String(15), nullable=False)
    username = Column(String(30), nullable=False)
    password = Column(String(32), nullable=False)
    lastupdate = Column(Integer, nullable=False)
    key = Column(String(50), nullable=False)
    secret = Column(String(50), nullable=False)
    styleid = Column(Integer, nullable=False)
    subscribeurl = Column(String(120), nullable=False)
    auth_refresh_token = Column(String(255), nullable=False)

    class Config:
        from_attributes = True





class AccountAliapp(Base):
    __tablename__ = 'ims_account_aliapp'

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, nullable=False)
    level = Column(SmallInteger, nullable=False)
    name = Column(String(30), nullable=False)
    description = Column(String(255), nullable=False)
    key = Column(String(16), nullable=False)

    class Config:
        from_attributes = True

class AccountBaiduapp(Base):
    __tablename__ = "ims_account_baiduapp"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, index=True, nullable=False)
    name = Column(String(30), nullable=False)
    appid = Column(String(32), nullable=False)
    key = Column(String(32), nullable=False)
    secret = Column(String(32), nullable=False)
    description = Column(String(255), nullable=False)

    class Config:
        from_attributes = True


class AccountPhoneapp(Base):
    __tablename__ = "ims_account_phoneapp"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, index=True, nullable=False)
    name = Column(String(255), nullable=False)

    class Config:
        from_attributes = True

class AccountToutiaoapp(Base):
    __tablename__ = "ims_account_toutiaoapp"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, index=True, nullable=False)
    name = Column(String(30), nullable=False)
    appid = Column(String(32), nullable=False)
    key = Column(String(32), nullable=False)
    secret = Column(String(50), nullable=False)
    description = Column(String(255), nullable=False)

    class Config:
        from_attributes = True



class Account(Base):
    __tablename__ = "ims_account"

    acid = Column(Integer, primary_key=True, autoincrement=True)
    uniacid = Column(Integer, nullable=False, index=True)
    hash = Column(String(8), nullable=False)
    type = Column(SmallInteger, nullable=False)
    isconnect = Column(SmallInteger, nullable=False)
    isdeleted = Column(SmallInteger, nullable=False)
    endtime = Column(Integer, nullable=False)
    send_account_expire_status = Column(SmallInteger, nullable=False)
    send_api_expire_status = Column(SmallInteger, nullable=False)

    class Config:
        from_attributes = True



class AccountWebapp(Base):
    __tablename__ = "ims_account_webapp"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, index=True)
    name = Column(String(255))

    class Config:
        from_attributes = True

class AccountWxapp(Base):
    __tablename__ = "ims_account_wxapp"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, index=True, nullable=False)
    token = Column(String(32), nullable=False)
    encodingaeskey = Column(String(43), nullable=False)
    level = Column(SmallInteger, nullable=False)
    account = Column(String(30), nullable=False)
    original = Column(String(50), nullable=False)
    key = Column(String(50), nullable=False)
    secret = Column(String(50), nullable=False)
    name = Column(String(30), nullable=False)
    appdomain = Column(String(255), nullable=False)
    auth_refresh_token = Column(String(255))

    class Config:
        from_attributes = True

class AccountXzapp(Base):
    __tablename__ = "ims_account_xzapp"

    acid = Column(Integer, primary_key=True)
    uniacid = Column(Integer, index=True, nullable=False)
    name = Column(String(255), nullable=False)
    original = Column(String(50), nullable=False)
    lastupdate = Column(Integer, nullable=False)
    styleid = Column(Integer, nullable=False)
    createtime = Column(Integer, nullable=False)
    token = Column(String(32), nullable=False)
    encodingaeskey = Column(String(255), nullable=False)
    xzapp_id = Column(String(30), nullable=False)
    level = Column(SmallInteger, nullable=False)
    key = Column(String(80), nullable=False)
    secret = Column(String(80), nullable=False)

    class Config:
        from_attributes = True